<?php

/**
 * Apartament form base class.
 *
 * @method Apartament getObject() Returns the current form's model object
 *
 * @package    acap
 * @subpackage form
 * @author     Verminu
 */
abstract class BaseApartamentForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'proprietar'       => new sfWidgetFormInputText(),
      'numar'            => new sfWidgetFormInputText(),
      'etaj'             => new sfWidgetFormInputText(),
      'scara_id'         => new sfWidgetFormPropelChoice(array('model' => 'Scara', 'add_empty' => false)),
      'spatiu_inchiriat' => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'deleted_at'       => new sfWidgetFormDateTime(),
      'added_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'proprietar'       => new sfValidatorString(array('max_length' => 128)),
      'numar'            => new sfValidatorString(array('max_length' => 8)),
      'etaj'             => new sfValidatorInteger(array('min' => -32768, 'max' => 32767)),
      'scara_id'         => new sfValidatorPropelChoice(array('model' => 'Scara', 'column' => 'id')),
      'spatiu_inchiriat' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(array('required' => false)),
      'updated_at'       => new sfValidatorDateTime(array('required' => false)),
      'deleted_at'       => new sfValidatorDateTime(array('required' => false)),
      'added_at'         => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('apartament[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Apartament';
  }


}
